home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / UsingObjects / ScreenObjectList.s < prev   
Encoding:
Text File  |  1997-05-01  |  3.2 KB  |  114 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;Open a screen using an external OBJect file.
  3. ;--------------------------------------------
  4. ;This demo will open a screen, based on the parameters in an external object
  5. ;file.  This allows a VERY high level of external editing that will alter
  6. ;how this program behaves, without having to reassemble it.
  7. ;
  8. ;This feature is highly important as it allows up to 100% configurability of
  9. ;your game, which previously has only been available to applications using
  10. ;libraries such as MUI.  However, it is even more powerful than this as
  11. ;graphic artists could not only create new datasets for your game, but also
  12. ;alter the dimensions, colours, resolution, attributes (and more) of your
  13. ;BOBs and screens.  Support for code segments is also available, so
  14. ;external functions could be altered and improved by programmers.  This will
  15. ;ensure that your game has a long lasting future as it keeps up with current
  16. ;technology and additions to GMS.
  17. ;
  18. ;I hope you make the most of external objects, its worth it!
  19.  
  20.     INCDIR    "INCLUDES:"
  21.     INCLUDE    "games/games_lib.i"
  22.     INCLUDE    "games/games.i"
  23.  
  24. CALL    MACRO
  25.     jsr    _LVO\1(a6)
  26.     ENDM
  27.  
  28.     SECTION    "ObjectTags",CODE
  29.  
  30. ;===========================================================================;
  31. ;                             INITIALISE DEMO
  32. ;===========================================================================;
  33.  
  34.     STARTGMS
  35.  
  36. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  37.     move.l    GMSBase(pc),a6
  38.     lea    OBJName(pc),a0    ;a0 = Name of the object file.
  39.     CALL    LoadObjectFile    ;>> = Go and load it.
  40.     move.l    d0,ObjectBase    ;MA = Save the base.
  41.     beq.s    .Error_ObjectFile    ;>> = Quit if error.
  42.  
  43.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  44.     lea    Objects(pc),a1    ;a1 = A list of objects to get.
  45.     CALL    GetObjectList    ;>> = Get our objects.
  46.     tst.l    d0    ;d0 = Success?
  47.     bne.s    .Error_Screen    ;>> = Quit if error.
  48.  
  49.     move.l    Screen(pc),a0    ;a0 = GameScreen tags
  50.     CALL    AddScreen    ;>> = Initialise the screen.
  51.     tst.l    d0    ;MA = Save pointer to the GameScreen.
  52.     beq.s    .Error_Screen    ;>> = Quit if error.
  53.  
  54.     move.l    Screen(pc),a0
  55.     move.l    Picture(pc),a1
  56.     move.l    GS_MemPtr1(a0),PIC_Data(a1)
  57.     CALL    LoadPic
  58.     tst.l    d0
  59.     beq.s    .Error_Picture
  60.  
  61.     move.l    PIC_Palette(a1),GS_Palette(a0)
  62.     CALL    UpdatePalette
  63.  
  64.     CALL    ShowScreen
  65.  
  66.     bsr.s    Main
  67.  
  68. .ReturnToDOS
  69.     move.l    GMSBase(pc),a6
  70.     move.l    Picture(pc),a1
  71.     CALL    FreePic
  72. .Error_Picture
  73.     move.l    Screen(pc),a0
  74.     CALL    DeleteScreen
  75. .Error_Screen
  76.     move.l    ObjectBase(pc),a0
  77.     CALL    FreeObjectFile
  78. .Error_ObjectFile
  79.     MOVEM.L    (SP)+,A0-A6/D1-D7
  80.     moveq    #ERR_OK,d0
  81.     rts
  82.  
  83. ;===========================================================================;
  84. ;                                MAIN LOOP
  85. ;===========================================================================;
  86.  
  87. Main:    CALL    WaitVBL
  88.     moveq    #JPORT1,d0
  89.     CALL    ReadMouse
  90.     btst    #MB_LMB,d0
  91.     beq.s    Main
  92.     rts
  93.  
  94. ;===========================================================================;
  95. ;                                  DATA
  96. ;===========================================================================;
  97.  
  98. ObjectBase:    dc.l  0
  99. OBJName:    dc.b  "GMS:demos/data/OBJ.Screen",0
  100.         even
  101.  
  102. Objects    dc.l    OBJECTLIST,0
  103.     dc.l    TXT_Screen
  104. Screen:    dc.l    0
  105.     dc.l    TXT_Picture
  106. Picture    dc.l    0
  107.     dc.l    LISTEND
  108.  
  109. TXT_Screen:    dc.b  "Screen",0
  110.         even
  111. TXT_Picture:    dc.b  "Picture",0
  112.         even
  113.  
  114.